package com.masterclient.app.businessmodule.vipmodule.bean;

import android.text.TextUtils;

import java.io.Serializable;
import java.util.List;

public class Order implements Serializable {



    /**
     * order_type : order
     * order : {"id":"12","order_no":"O2021042917132011851","type":"2","order_type":"0","status":"1","status_label":"待审核","buyer_name":"初始化大哥","buyer_headimage":"","products":[{"id":"11","product_id":"5000001","parent_product_id":"1","name":"自营商品001","image":"http://oss.xrkmall.com/upload_dev/product/f/d/b/fdb48cc23cce9e64fff3ae64bfc38b1e.jpg?x-oss-process=image/resize,m_fixed,w_300","attribute_desc":"颜色:红色","price":"30","integral":"0","buy_qty":"1"}],"product_num":"1","shipping_amount":"0","subtotal":"30","create_at":"2021-04-29 17:13:12","replenish_product_map":[]}
     * button : {"replenish_btn":"0","delivery_btn":"1","view_track_btn":"0"}
     */

    private String order_type;
    private OrderBean order;
    private ButtonBean button;

    public String getStatusText() {
        return order.getStatus_label();
    }

    public String getOrder_type() {
        return order_type;
    }

    public void setOrder_type(String order_type) {
        this.order_type = order_type;
    }

    public OrderBean getOrder() {
        return order;
    }

    public void setOrder(OrderBean order) {
        this.order = order;
    }

    public ButtonBean getButton() {
        return button;
    }

    public void setButton(ButtonBean button) {
        this.button = button;
    }

    public static class OrderBean implements Serializable{
        /**
         * id : 12
         * order_no : O2021042917132011851
         * type : 2
         * order_type : 0
         * status : 1
         * status_label : 待审核
         * buyer_name : 初始化大哥
         * buyer_headimage :
         * products : [{"id":"11","product_id":"5000001","parent_product_id":"1","name":"自营商品001","image":"http://oss.xrkmall.com/upload_dev/product/f/d/b/fdb48cc23cce9e64fff3ae64bfc38b1e.jpg?x-oss-process=image/resize,m_fixed,w_300","attribute_desc":"颜色:红色","price":"30","integral":"0","buy_qty":"1"}]
         * product_num : 1
         * shipping_amount : 0
         * subtotal : 30
         * create_at : 2021-04-29 17:13:12
         * replenish_product_map : []
         */

        private String id;
        private String order_no;
        private String type;
        private String order_type;
        private String status;
        private String status_label;
        private String buyer_name;
        private String buyer_headimage;
        private String product_num;
        private String shipping_amount;
        private String subtotal;
        private String create_at;
        private List<Products> products;
        private List<?> replenish_product_map;
        private String attribution_tip;
        private String arrival_amount;

        public void setServiceOrder(ServiceOrder serviceOrder){
            status_label = serviceOrder.getRefund_status_desc();
            buyer_headimage = serviceOrder.getHeadimgurl();
            buyer_name = serviceOrder.getNick_name();
            create_at = serviceOrder.getCreate_at();
            order_no = serviceOrder.getRefund_no();
            product_num = serviceOrder.getProduct_num();
            subtotal = serviceOrder.getRefund_amount();
            products = serviceOrder.getProduct_list();
        }

        public String getStatusText() {
            return status_label;
        }

        public String getArrival_amount() {
            return arrival_amount;
        }

        public void setArrival_amount(String arrival_amount) {
            this.arrival_amount = arrival_amount;
        }

        public String getId() {
            return id;
        }

        public void setId(String id) {
            this.id = id;
        }

        public String getOrder_no() {
            return order_no;
        }

        public void setOrder_no(String order_no) {
            this.order_no = order_no;
        }

        public String getType() {
            return type;
        }

        public void setType(String type) {
            this.type = type;
        }

        public String getOrder_type() {
            return order_type;
        }

        public void setOrder_type(String order_type) {
            this.order_type = order_type;
        }

        public int getStatus() {
            if(TextUtils.isEmpty(status))
                return -1;
            return Integer.parseInt(status);
        }

        public void setStatus(String statusX) {
            this.status = statusX;
        }

        public String getStatus_label() {
            if(getStatus() == 4)
                return "已收货";
            return status_label;
        }

        public void setStatus_label(String status_label) {
            this.status_label = status_label;
        }

        public String getBuyer_name() {
            return buyer_name;
        }

        public void setBuyer_name(String buyer_name) {
            this.buyer_name = buyer_name;
        }

        public String getBuyer_headimage() {
            return buyer_headimage;
        }

        public void setBuyer_headimage(String buyer_headimage) {
            this.buyer_headimage = buyer_headimage;
        }

        public String getProduct_num() {
            return product_num;
        }

        public void setProduct_num(String product_num) {
            this.product_num = product_num;
        }

        public String getShipping_amount() {
            return shipping_amount;
        }

        public void setShipping_amount(String shipping_amount) {
            this.shipping_amount = shipping_amount;
        }

        public String getAttribution_tip() {
            return attribution_tip;
        }

        public void setAttribution_tip(String attribution_tip) {
            this.attribution_tip = attribution_tip;
        }

        public String getSubtotal() {
            return subtotal;
        }

        public void setSubtotal(String subtotal) {
            this.subtotal = subtotal;
        }

        public String getCreate_at() {
            return create_at;
        }

        public void setCreate_at(String create_at) {
            this.create_at = create_at;
        }

        public List<Products> getProducts() {
            return products;
        }

        public void setProducts(List<Products> products) {
            this.products = products;
        }

        public List<?> getReplenish_product_map() {
            return replenish_product_map;
        }

        public void setReplenish_product_map(List<?> replenish_product_map) {
            this.replenish_product_map = replenish_product_map;
        }
    }

    public static class ButtonBean implements Serializable {
        /**
         * replenish_btn : 0
         * delivery_btn : 1
         * view_track_btn : 0
         */

        private int replenish_btn;
        private int delivery_btn;
        private int view_track_btn;

        public int getReplenish_btn() {
            return replenish_btn;
        }

        public void setReplenish_btn(int replenish_btn) {
            this.replenish_btn = replenish_btn;
        }

        public int getDelivery_btn() {
            return delivery_btn;
        }

        public void setDelivery_btn(int delivery_btn) {
            this.delivery_btn = delivery_btn;
        }

        public int getView_track_btn() {
            return view_track_btn;
        }

        public void setView_track_btn(int view_track_btn) {
            this.view_track_btn = view_track_btn;
        }
    }
}
